#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <assert.h>
#include <stdarg.h>
#include <errno.h>
#include <share.h>

typedef void (*func_print_t)(void*);

typedef int (*func_cmp_t)(const void* c1, const void* c2);

typedef void (*func_mod_t)(void* m1, void* m2);

typedef struct node_t
{
	void* data;
	int size;
	int count;
	struct node_t* next;
	struct node_t* prev;
}Node_t;

void init(Node_t** head, int size);

void push_back(Node_t* head, void* newnode);

void push_front(Node_t* head, void* newnode);

void push_pos(Node_t* head, int pos, void* newnode);

void* find_pos(Node_t* head, int pos);

void* find_front(Node_t* head, void* key, func_cmp_t cmp);

void* find_back(Node_t* head, void* key, func_cmp_t cmp);

Node_t* find_All(Node_t* head, void* key, func_cmp_t cmp);

void mod_front(Node_t* head, void* oldKey, func_cmp_t cmp, void* newKey, func_mod_t mod);

void mod_back(Node_t* head, void* oldKey, func_cmp_t cmp, void* newKey, func_mod_t mod);

void mod_All(Node_t* head, void* oldKey, func_cmp_t cmp, void* newKey, func_mod_t mod);

void mod_pos(Node_t* head, int pos, void* newKey, func_mod_t mod);

void pop_front(Node_t* head, void* key, func_cmp_t cmp);

void pop_back(Node_t* head, void* key, func_cmp_t cmp);

void pop_All(Node_t* head, void* key, func_cmp_t cmp);

void pop_pos(Node_t* head, int pos);

void list_write(Node_t* head, char* path);

void list_read(Node_t* head, char* path);

void print(Node_t* head, func_print_t ls);

void destory(Node_t* head);

Node_t* reversal_list(Node_t* head);
